<template>
  <!-- 短信管家 智能卡位 接收的 短信  管理端 -->
  <div class="app-container ">
    <div class="" v-loading="loading">
      <el-form :model="queryParams" ref="queryForm" :inline="true" class=" search-form-new" label-width="auto">
     
        <el-form-item label="手机号" prop="phone">
          <el-input v-model="queryParams.phone" placeholder="手机号" clearable size="small" />
        </el-form-item>
        <el-form-item label="时间" prop="timer">
          <el-date-picker clearable v-model="timer" type="daterange" range-separator="至" value-format="yyyy-MM-dd" start-placeholder="开始日期" end-placeholder="结束日期">
          </el-date-picker>
        </el-form-item>
        <el-form-item class="btns">
          <el-button type="primary" icon="el-icon-search" @click="search" class="zdy-btn">搜索</el-button>
        </el-form-item>
      </el-form>
      <div class="table_box">
        <el-table stripe :data="tableData.records">
          <el-table-column prop="id" label="序号" width="80"></el-table-column>
          <el-table-column prop="" label="是否租用" width="100">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.isMyTel==1" type="success">自用</el-tag>
              <el-tag v-if="scope.row.isMyTel==2" type="warning">租用卡位</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="" label="卡位类型" width="100">
            <template slot-scope="scope">
              <el-tag v-if="scope.row.type==1" type="success">短信管家</el-tag>
              <el-tag v-if="scope.row.type==2" type="warning">智能卡位</el-tag>
            </template>
          </el-table-column>
          <el-table-column prop="yongyouTenantName" label="卡位归属"></el-table-column>
          <el-table-column prop="zulinTenantName" label="租赁方" ></el-table-column>
          <el-table-column prop="phone" label="卡位号码" ></el-table-column>
          <el-table-column prop="fromNumber" label="对方号码" ></el-table-column>
          <el-table-column prop="createTime" label="时间" ></el-table-column>
          
          <el-table-column prop="content" label="短信内容" min-width="250"></el-table-column>
        </el-table>
        <pagination v-show="tableData.total > 0" :total="tableData.total" :page.sync="queryParams.pageNum" :limit.sync="queryParams.pageSize" @pagination="getList" />
      </div>
    </div>
  </div>
</template>

<script>
import phoneApi from "@/api/phoneManage";
export default {
  name: "",
  data() {
    return {
      timer: [],
      tableData: {
        records: [],
        total: 0,
      },
      loading: false,
      queryParams: {
        pageNum: 1,
        pageSize: 10,
        dataType:'jsdx'
      },
    };
  },
  created() {
    this.getList();
  },
  activated() {},
  methods: {
    // 获取列表
    getList() {
      this.loading = true;
      if (this.timer && this.timer.length) {
        this.queryParams.createTimeStart = this.timer[0] + " 00:00:00";
        this.queryParams.createTimeEnd = this.timer[1] + " 23:59:59";
      } else {
        this.queryParams.createTimeStart = "";
        this.queryParams.createTimeEnd = "";
      }
      phoneApi.appMessagelist(this.queryParams).then((response) => {
        this.tableData.records = response.rows;
        this.tableData.total = response.total;
        this.loading = false;
      });
    },
    copy(txt) {
      this.$copyText(txt).then((res) => {
        this.$message.success("已复制到剪切板");
      });
    },
    // 搜索
    search() {
      this.queryParams.pageNum = 1;
      this.getList();
    },

    //重置
    resetQuery() {
      this.queryParams = {
        pageNum: 1,
        pageSize: 10,
        dataType:'jsdx'
      };
      this.timer = [];
      this.getList();
    },
  },
};
</script>
<style lang="scss" scoped>
.tips{
  font-size: 16px;
  margin-bottom: 10px;
  color: red;
}
.link-box {
  > div {
    text-align: center;
    margin-bottom: 10px;
  }
  .mylink {
    margin-right: 10px;
    a {
      color: $primary;
    }
  }
}
</style>